<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            perspective: 600px;
        }
        .father {
            transition: all 0.5s;
            transform-style: preserve-3d;
            position: relative;
            width: 200px;
            height: 50px;
            /* border: 2px solid #000; */
            margin-top: 600px;
            margin-left: 200px;
            /* bottom: 50px;
            left: 50px; */
        }
        .father div {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
        }
        .son1 {
            background-color: pink;
            transform: translateZ(25px);
        }
        .son2 {
            background-color: purple;
            transform: translateY(-25px) rotateX(90deg);
        }
        .father:hover {
            transform: rotateX(-90deg);
        }
    </style>
</head>
<body>
    <div class="father">
        <div class="son1"></div>
        <div class="son2"></div>
    </div>
</body>
</html>